﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Manage_ProductTypeUpdate : System.Web.UI.Page
{
    private string SortId;

    protected void Page_Load(object sender, EventArgs e)
    {
        //SortId = Request.QueryString["SortId"].ToString();
        SortId = "23";
        if (!this.IsPostBack)
        {
            HZ.MBSM.DBUtility.Db db = new HZ.MBSM.DBUtility.Db(false);
            Grove.ORM.ObjectOperator oo = db.GetObjectOperator();
            HZ.MBSM.Model.product_sort Sort = (HZ.MBSM.Model.product_sort)oo.Retrieve(typeof(HZ.MBSM.Model.product_sort), SortId);

            if (Sort != null)
            {
                SortName.Text = Sort.SortName;
                FrontSortId.Value = Sort.FrontSortId.ToString();
            }

            oo.Dispose();
            db.Close();
        }
    }

    protected void BtnAdd_Click(object sender, EventArgs e)
    {
        HZ.MBSM.DBUtility.Db db = new HZ.MBSM.DBUtility.Db(false);
        Grove.ORM.ObjectOperator oo = db.GetObjectOperator();
        HZ.MBSM.Model.product_sort Sort = (HZ.MBSM.Model.product_sort)oo.Retrieve(typeof(HZ.MBSM.Model.product_sort), SortId);

        if (Sort != null)
        {
            Sort.SortName = SortName.Text;
            Sort.FrontSortId = Convert.ToInt32( FrontSortId.Value);
            oo.Update(Sort);
        }

        oo.Dispose();
        db.Close();
    }
}
